package com.lianzhihui.minitiktok.ui.main.one

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.echofeng.common.ui.base.BaseFragment
import com.lianzhihui.minitiktok.adapter.hot.GoldOneAdapter
import com.lianzhihui.minitiktok.adapter.user.UserHomeVideoAdapter
import com.lianzhihui.minitiktok.bean.hot.VideoResponse
import com.lianzhihui.minitiktok.presenter.UserVideoPresnterImp
import com.lianzhihui.minitiktok.view.UserVideoView
import com.lianzhihui.onlyleague.R
import kotlinx.android.synthetic.main.fragment_user_home_video.*

private const val ARG_PARAM1 = "param1"
/**
 * A simple [Fragment] subclass.
 * Use the [UserHomeVideoFragment.newInstance] factory method to
 * create an instance of this fragment.
 */
class UserHomeVideoFragment : BaseFragment() ,UserVideoView{
    private lateinit var userVideoPresnterImp: UserVideoPresnterImp
    private lateinit var adapter: UserHomeVideoAdapter
    private var colomNum: Int = 1
    companion object {
        @JvmStatic
        fun newInstance(param1: Int) =
                VideoPageFragment().apply {
                    arguments = Bundle().apply {
                        putInt(ARG_PARAM1, param1)
                    }
                }
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            colomNum = it.getInt(ARG_PARAM1)
        }
    }
    override fun getLayoutId(): Int {
        return R.layout.fragment_gold_one
    }

    override fun initView() {
        adapter = UserHomeVideoAdapter(ArrayList())
        val layoutManager = LinearLayoutManager(context)
        layoutManager.orientation = RecyclerView.VERTICAL
        mRecyclerView.setLayoutManager(layoutManager)
        mRecyclerView.setAdapter(adapter)
    }

    override fun initData() {
        userVideoPresnterImp = UserVideoPresnterImp(context,this);
        when(colomNum){
            1->{     userVideoPresnterImp.getOwnVideo(pageNum)}
            2->{     userVideoPresnterImp.getLikeVideo(pageNum)}
            3->{     userVideoPresnterImp.getBuyVideo(pageNum)}
        }

    }

    override fun setSuccess(o: Any?) {
    }

    override fun setFailure(o: Any?) {
    }

    override fun setMineVideoSuccess(data: MutableList<VideoResponse>?) {
    }

    override fun setLikeVideoSuccess(data: MutableList<VideoResponse>?) {
    }

    override fun setBuyVideoSuccess(data: MutableList<VideoResponse>?) {
    }

}